<?php
	require_once('newSearch.php');
	$content="";
	$count=getWebContent($content);
	$search_count=$count['total_results'];
	$export_sql=$count['export_sql'];
	$pagecount=$count['pagecount'];

	$baseUrl="http://10.108.107.221/lab/Searchresult.html?";
	$condition="";
	foreach($_GET as $key=>$val)
	{
		if($key=='action')
			$val="";
		$condition.=empty($condition)?"":"&";
		$condition.=$key."=".$val;
	}
	$baseUrl.=$condition;
	$_GET['number_per_page']=empty($_GET['number_per_page'])?"5":$_GET['number_per_page'];
	$_GET['order']=empty($_GET['order'])?"1":$_GET['order'];
	$_GET['page_index']=empty($_GET['page_index'])?1:$_GET['page_index'];

?>
	



<!DOCTYPE html>
<!-- saved from url=(0038)http://vision.stanford.edu/people.html -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" class=" js postmessage history draganddrop borderimage borderradius boxshadow textshadow cssgradients csstransforms csstransforms3d csstransitions generatedcontent localstorage sessionstorage">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
	<title>学术成果搜索结果</title>
 
<link href="css/bootstrapmin.css" rel="stylesheet" media="screen">
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen, print" href="css/Searchresult/styles.css">
<script type="text/javascript" src="js/multichoices.js"></script>
<script type="text/javascript" src="js/header.js"></script>

	
</head>

<body class="landing-page">
	
<?php
	require("header.php");
?>


	
		
		<!-- BEGIN: BodyWrapper -->
<div id = "achievement">
	<?php
	require("DBops.php");
	//session_start();
	if(isset($_SESSION['user'])){
				$con = connect("localhost", "root", "", "lab");
				$result = query($con, "*", "personalinfo", "ID", $_SESSION['user']);
				$row = mysql_fetch_array($result);
	
			echo "<div style='height:30px;background:#A4D3EE;'>
		      
              <p  style='margin-right:10px;float:right;'>登录为: <a href = \"infor.php?id=".$_SESSION['user']."\">".$_SESSION['user']."</a></font>&nbsp&nbsp<a  onclick=\"if(confirm('确定要退出系统吗?')){parent.location.href ='logout.php'}\" href=\"javascript:void(0)\">退出</a></font></p></div>";
	}
	else
	{   $_SESSION['userurl'] = $_SERVER['REQUEST_URI']; 
		echo "<div style='height:30px;background:#A4D3EE;'>
				<ul>
              <li  style='margin-right:10px;float:right;'><a href ='login.php'>登录</a></div>";
	}
	
?>					

  <div id="results-hdr">
	<strong>Search Results</strong>
	<div class="content" id="content">
			<div class="refinement">
				<span style="float:left">
					
							<strong class="search-term">
								
							</strong>
				</span> 	
	
			</div>

		<div class="ClearFix"><!-- do not remove --></div>

			<span class="display-status results-returned">
				<?php echo $search_count;?> 条记录
			</span>		
	   </div>
	
</div>
<!--  End results hdr -->





<form name="search_results_form" id="search_results_form" >
	<input type="hidden" name="baseUrl" id="baseUrl" value="<?php echo $baseUrl;?>">

	<input type="hidden" name="pageNumber"	id="pageNumber"> 
	<input type="hidden" name="prevArticle" id="prevArticle" /> 
	<input type="hidden" name="nextArticle" id="nextArticle" /> 
	<input type="hidden" name="savedSearchTitle" id="savedSearchTitle" 
			value="" />
<script type="text/javascript">
 
	
	 function sortAction() {
		var baseurl=document.search_results_form.baseUrl.value;
		   
	   var order = document.search_results_form.order_index.value;
	  
	   var url_string = baseurl+"&order="+order;
	 //  alert(url_string);
		
	   location.href = url_string;
		 var order_selected_value=document.getElementById("order_selected_index").value;
		var i=order_selected_value;
		alert(i);
		
		document.getElementById(order_index).options[i].selected=true;
	 
	 }
	
	 function rowsPerPageAction() {

		var baseurl=document.search_results_form.baseUrl.value;
	   var number_per_page = document.search_results_form.number_per_page.value;
	 //  alert(number_per_page);
	   var url_string = baseurl+"&number_per_page="+number_per_page;
	  
	   location.href = url_string;
	   var number_per_page1 = document.search_results_form.number_per_page;
	  // alert(number_per_page1.length);
		 var number_per_page_index=document.getElementById("number_per_page_index").value;
		var aaa=document.search_results_form.number_per_page.value = number_per_page_index; 
		var i=number_per_page_index/5 -1;
		alert(aaa);
		//alert(i);
		number_per_page1.options[i].selected=true;
	}
	function gotoPage(pagenum) {

		var baseurl=document.search_results_form.baseUrl.value;
		var url_string = baseurl+"&page_index="+pagenum;
		
	   location.href = url_string;
	 }
	
	
	function hdShowAbs(abs_id)
	{
		(document.getElementById(abs_id).style.display == 'block')?(document.getElementById(abs_id).style.display ='none'):(document.getElementById(abs_id).style.display = 'block');
		
	}
</script>


	
		<div class="page-tools page-tools-results">
			<span class="field">
					<fieldset class="display-options">
						<label for="" class="" style="float:left;"> 每页显示: </label> 
						
						<span class="field">
						<!-- <input type="hidden" id ="number_per_page_index" value="<?php echo"".$_GET['number_per_page']."";?>"/> -->
						
						<select name="number_per_page" id="number_per_page"	onchange="rowsPerPageAction();" style="width:60px;height:25px;">
							
							<option value="5" <?php echo $_GET['number_per_page']==5?"selected='true'":"";?>
							
							>5</option>
							
							<option value="10" <?php echo $_GET['number_per_page']==10?"selected='true'":"";?>
							>10</option>
							
							<option value="15" <?php echo $_GET['number_per_page']==15?"selected='true'":"";?>
							>15</option>
							
							
							<option value="20" <?php echo $_GET['number_per_page']==20?"selected='true'":"";?>
							>20</option>
							
						</select>
						</span> 
					</fieldset>
            </span>
				
				
				
								
				<span class="floatRight padRight15 textAlignRight" >
					<fieldset class="sort">
					<label  style="float:left;align:center;" >排序: </label> 
				
					<select name="order_index" id="order_index"
						onchange="sortAction();" style="width:120px;height:25px;"  >
						<option value="-1" <?php echo $_GET['order']==-1?"selected='true'":"";?>
							>请选择
						</option>
						
				
						<option value="3" <?php echo $_GET['order']==3?"selected='true'":"";?>
							>最新发表在前
						</option>
				
						<option value="4" <?php echo $_GET['order']==4?"selected='true'":"";?>
							>较早发表在前
						</option>
						<option value="7" <?php echo $_GET['order']==7?"selected='true'":"";?>
						
						>会议在前	</option>
						<option value="8" <?php echo $_GET['order']==8?"selected='true'":"";?>
						
						>期刊在前	</option>
						<!--<option value="9" 
						>	</option>
						<option value="5" <?php echo $_GET['order']==5?"selected='true'":"";?>
				 	>被引次数增</option>
						
						
							<option value="6" <?php echo $_GET['order']==6?"selected='true'":"";?>
								>被引次数减</option>
						<option value="1"  
							>标题[A-Z]</option> <?php echo $_GET['order']==1?"selected='true'":"";?>
						<option value="2"  <?php echo $_GET['order']==2?"selected='true'":"";?>
							>标题[Z-A] 
						</option>-->
						
						</select>
					</fieldset>
				</span>
			
		</div>
				
				
<div class="results-display rdPadRemove"><!-- START PAGINATION -->
		<p class="links addition-pagination-links-left" id="toggle-all-checkboxes">
	
	
	<span id="select-all" class="link SelectAll"> 
	选择全部页面 </span> <span class="link">|</span> 
	<span id="deselect-all" class="link DeSelectAll"> 取消选择所有页面</span></p>

		<ul class="pagination paginationTop">			
				
				<li class="next smFont">&nbsp;&nbsp;&nbsp;<a href="#highlight1"
				onclick="javascript:gotoPage('1')"
				title="First"><span>&laquo;</span> 首页</a></li>
			<li>|&nbsp;&nbsp;</li>
	
		
							<?php 
						//$_GET['page_index']-1  1-5 余5  0-4
						$start_page_index=$_GET['page_index']-($_GET['page_index']-1)%5;
						if($start_page_index>5){
							?>
							<li class="next">
							<a href="#"	onclick="javascript:gotoPage('<?php echo $start_page_index-5;?>')">
								<img src="img/double-arrow-prev.gif" alt="" />
							</a>
							</li>
							<?php
							}

						$end_page_index=($start_page_index+5)>$pagecount?($pagecount+1):($start_page_index+5);
						for($i=$start_page_index;$i<$end_page_index;++$i)
						{
							if($_GET['page_index']==$i){//当前页
							?>
								<li>&nbsp;&nbsp;&nbsp;<span><?php echo $i;?></span>&nbsp</li>
								<?php
								}
								else{
								?>
								<li >&nbsp;&nbsp;&nbsp;<a href="#" onclick="javascript:gotoPage('<?php echo $i;?>')" title="Page <?php echo $i;?>" alt="Page <?php echo $i;?>" style="width:10px;height:15px;margin-bottom:3px;"><?php echo $i;?></a>&nbsp</li>
					<?php
								}}
						if($end_page_index<$pagecount){
						?>
						<li class="next">&nbsp;&nbsp;&nbsp;
						<a href="#"	onclick="javascript:gotoPage('<?php echo $end_page_index;?> ')">
							<img src="img/double-arrow-next.gif" alt="" />
						</a>
						</li>
					<?php }?>
				<li class="next smFont"><a href="#" title="Last" onclick="javascript:gotoPage('<?php echo $pagecount;?>')" style="width:15px;height:15px;margin-bottom:3px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;末页<span>&raquo;</span></a></li>

			</ul>
</div>
</form>	
<?php
 if(isset($_SESSION['user'])){echo"
 <div align='center'>
<input type='button' id='exportWord' value='导出Word' onClick='showExportWordChoices()'>　　<input id='exportExcel' type='button' value='导出Excel' onClick='showExportExcelChoices()'><br/><br/>
</div>
<div class='' id='exportItems' style='width:700px;margin:auto;display:none'>
	  <!--added by fj-->
		<form name='form1' method='post' action='downloadResult.php' target='_blank'> 
		<input type='hidden' name='export_sql'value=''/>
		<table border='0' style='margin:auto' width='75%' cellspacing='0' cellpadding='0'> 
		<tr> 
		<td> 
		<table border='0' style='margin:auto'> 
		<tr> 
		<td> 
		<select name='leftItem' style='width:200px' size='10' multiple='multiple' id='leftExportItems'> 
		<option value='标题'>标题</option> 
		<option value='第一作者'>第一作者</option> 
		<option value='第二作者'>第二作者</option> 
		<option value='第三作者'>第三作者</option> 
		<option value='第四作者'>第四作者</option> 
		<option value='第五作者'>第五作者</option> 
		<option value='其他作者'>其他作者</option> 
		<option value='通信作者'>通信作者</option> 
		<option value='检索号'>检索号</option> 
		<option value='原文语言'>原文语言</option> 
		<option value='发表时间'>发表时间</option> 
		<option value='期刊会议名'>期刊会议名</option> 
		<option value='卷'>卷</option> 
		<option value='期'>期</option> 
		<option value='页码'>页码</option> 
		<option value='会议地点'>会议地点</option> 
		<option value='关键词'>关键词</option> 
		<option value='领域'>领域</option> 
		<option value='DOI'>DOI</option> 
		<option value='全文下载'>全文链接</option> 
		<option value='摘要'>摘要</option> 
		<option value='ISSN'>ISSN</option> 
		<option value='CN'>CN</option> 
		<option value='ISBN'>ISBN</option> 
		<option value='基金'>基金</option> 
		<option value='被引次数'>被引次数</option> 
		<option value='论文类型'>论文类型</option> 
		</select> 
		</td> 
		</tr> 
		</table> 
		</td> 
		<td> 
		<table border='0' style='margin:auto'> 
		<tr><td height='30'><input type='button' name='button1' style='width:50px' value='>' onClick='fMoveSelectedOptionsLeftToRight(document.all.leftItem,document.all.rightItem)'></td></tr> 
		<tr><td height='30'><input type='button' name='button2' style='width:50px' value='>>' 
		onClick='fMoveAllOptionsLeftToRight(document.all.leftItem,document.all.rightItem)'></td></tr> 
		<tr><td height='30'><input type='button' name='button3' style='width:50px' value='<' 
		onClick='fMoveSelectedOptionsRightToLeft(document.all.leftItem,document.all.rightItem)'></td></tr> 
		<tr><td height='30'><input type='button' name='button4' style='width:50px' value='<<' 
		onClick='fMoveAllOptionsRightToLeft(document.all.leftItem,document.all.rightItem)'></td></tr> 
		</table> 
		</td> 
		<td> 
		<table border='0' style='margin:auto'> 
		<tr> 
		<td> 
		<select name='rightItem' style='width:200px' size='10' multiple='multiple' id='rightExportItems'> 
		</select> 
		</td> 
		</tr> 
		</table> 
		</td> 
		<td>
		<INPUT  type='button' style='width:24px' value='↑' onmousedown=\"setTimeStart('up');\"  onmouseup='clearTimeout(x);' onclick='upListItem();clearTimeout(x);'> 
		<INPUT  type='button' style='width:24px' value='↓' onmousedown=\"setTimeStart('down');\" onmouseup='clearTimeout(x);' onclick='downListItem();clearTimeout(x);'>
		</td>
		</tr> 
		<tr style='height:10px'>
		　　<!--用于样式-->
		</tr>
		</table> 
		<table border='0' style='margin:auto' id='submitExportItems' width='75%' cellspacing='0' cellpadding='0'> 
		
		</table> 
		
		
		</form> 

</div>"

;}
echo"</div>";
?>
<ul class="Results">  

<?php
	echo $content;
?>
</ul>
</div>

<div style="margin-left:auto;margin-right:auto;width:700px; clear:both;background:#FAF0E6;height:40px;">
<div class="results-display rdPadRemove"><!-- START PAGINATION -->
		<p class="links addition-pagination-links-left" id="toggle-all-checkboxes" style="float:left;">
	
	
	<span id="select-all" class="link SelectAll"> 
	选择全部页面 </span> <span class="link">|</span> 
	<span id="deselect-all" class="link DeSelectAll"> 取消选择所有页面</span></p>

		<ul class="pagination paginationTop">			
				
				<li class="next smFont"><a href="#highlight1"
				onclick="javascript:gotoPage('1')"
				title="First"><span>&laquo;</span> 首页</a></li>
			<li>|&nbsp;&nbsp;</li>
			
							
							<?php 
						//$_GET['page_index']-1  1-5 余5  0-4
						$start_page_index=$_GET['page_index']-($_GET['page_index']-1)%5;
						if($start_page_index>5){
							?>
							<li class="next">&nbsp;&nbsp;&nbsp;
							<a href="#"	onclick="javascript:gotoPage('<?php echo $start_page_index-5;?>')">
								<img src="img/double-arrow-prev.gif" alt="" />
							</a>
							</li>
							<?php
							}

						$end_page_index=($start_page_index+5)>$pagecount?($pagecount+1):($start_page_index+5);
						for($i=$start_page_index;$i<$end_page_index;++$i)
						{
							if($_GET['page_index']==$i){//当前页
							?>
								<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span><?php echo $i;?></span>&nbsp</li>
								<?php
								}
								else{
								?>
								<li >&nbsp;&nbsp;&nbsp;<a href="#" onclick="javascript:gotoPage('<?php echo $i;?>')" title="Page <?php echo $i;?>" alt="Page <?php echo $i;?>" style="width:10px;height:15px;margin-bottom:3px;"><?php echo $i;?></a>&nbsp</li>
					<?php
								}}
						if($end_page_index<$pagecount){
						?>
						<li class="next">&nbsp;&nbsp;&nbsp;
						<a href="#"	onclick="javascript:gotoPage('<?php echo $end_page_index;?> ')">
							<img src="img/double-arrow-next.gif" alt="" />
						</a>
						</li>
					<?php }?>
				<li class="next smFont"><a href="#" title="Last" onclick="javascript:gotoPage('<?php echo $pagecount;?>')" style="width:15px;height:15px;margin-bottom:3px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;末页<span>&raquo;</span